# Contributor: Leo <thinkabit.ukim@gmail.com>
# Contributor: Orson Teodoro <orsonteodoro@hotmail.com>
# Maintainer: Orson Teodoro <orsonteodoro@hotmail.com>
pkgname=py3-compdb
_pkgname=${pkgname#py3-*}
pkgver=0.2.0
pkgrel=8
pkgdesc="The compilation database Swiss army knife"
url="https://github.com/Sarcasm/compdb"
arch="noarch"
license="MIT"
depends="python3"
makedepends="py3-setuptools py3-gpep517"
subpackages="$pkgname-doc $pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/Sarcasm/$_pkgname/archive/v$pkgver.tar.gz"
builddir="$srcdir/"$_pkgname-$pkgver
replaces="py-compdb" # Backwards compat

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	gpep517 install-wheel --destdir .testenv --prefix '' .dist/*.whl
	.testenv/bin/python3 -m unittest discover
}

package() {
	gpep517 install-wheel --destdir "$pkgdir" \
		.dist/*.whl
	install -d "$pkgdir"/usr/share/doc/$_pkgname/
	install -t "$pkgdir"/usr/share/doc/$_pkgname/ README.rst
}

sha512sums="
9b3000db087243f20b91d4091d0eaa71951860eba87f74ce5dd895a2f249f816145c30a9e791752e82947d9d9f4bb9dc49738356d0af442f38aa1fd91c43cf22  py3-compdb-0.2.0.tar.gz
"
